import redis
import logging

class Config(object):

    # 配置SQLAlchemy
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1/information09'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 配置redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # session秘钥
    SECRET_KEY = 'zlCw7nHw2gM/TDla2zShtoFU7t3/DFkuT+Ot+YfYXjo='

    # 配置flask_session扩展
    SESSION_TYPE = 'redis'  # 设置同步的位置
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # 开启签名保证数据安全
    PERMANENT_SESSION_LIFETIME = 86400 * 7  # 配置过期时间


class DevelopmentConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.WARNING